package config

const (
	IDInvalid        = -1
	IDSign           = 20001
	IDSignSevenDays  = 20002
	IDPlaySeries1    = 20003
	IDPlaySeries2    = 20004
	IDPlaySeries3    = 20005
)

// 任务类型
const (
	TypeDay   = 1
	TypeWeek  = 2
	TypeMonth = 3
	TypeYear  = 4
)

var TaskList = []int{
	IDSign, IDSignSevenDays, IDPlaySeries1, IDPlaySeries2, IDPlaySeries3,
}

// 任务状态
const (
	StateInvalid   = -1
	StateNotFinish = 1
	StateFinish    = 2
	StateAwarded   = 3
)

// 签到类型
const (
	SignTypeToday = 1
	SignTypeAgo   = 2
)

var KeySign = "KEY_SIGN_%d_%s"
var SignExpireTime = 60 * 24 * 60 * 60 // 60天
var KeyTask = "KEY_TASK_%d_%s"

// TaskConfig 任务配置
type TaskConfig struct {
	TID       int       `json:"tid"`
	Type      int       `json:"type"`
	Action    int       `json:"action"`
	IconID    int       `json:"iconid"`
	Series    int       `json:"series"`
	Name      string    `json:"name"`
	Desc      string    `json:"desc"`
	Total     int       `json:"total"`
	Version   int       `json:"version"`
	RewardList []Reward `json:"rewardlist"`
}

// Reward 奖励
type Reward struct {
	ID  int `json:"id"`
	Num int `json:"num"`
}

var TaskCfg = map[int]TaskConfig{
	IDSign: {
		TID: IDSign, Type: TypeDay, IconID: 20001, Series: IDInvalid,
		Name: "每日签到", Desc: "每日签到后领取奖励",
		Total: 1, Version: 10000,
		RewardList: []Reward{{ID: 1000, Num: 500}},
	},
	IDSignSevenDays: {
		TID: IDSignSevenDays, Type: TypeWeek, IconID: 20002, Series: IDInvalid,
		Name: "每周签到", Desc: "每周签到7天后领取奖励",
		Total: 7, Version: 10000,
		RewardList: []Reward{{ID: 1000, Num: 50000}},
	},
	IDPlaySeries1: {
		TID: IDPlaySeries1, Type: TypeDay, IconID: 20003, Series: IDInvalid,
		Name: "对局5场", Desc: "每日进行5场游戏后领取奖励",
		Total: 5, Version: 10000,
		RewardList: []Reward{{ID: 1000, Num: 500}},
	},
	IDPlaySeries2: {
		TID: IDPlaySeries2, Type: TypeDay, IconID: 20004, Series: IDPlaySeries1,
		Name: "对局10场", Desc: "每日进行10场游戏后领取奖励",
		Total: 10, Version: 10000,
		RewardList: []Reward{{ID: 1000, Num: 1000}},
	},
	IDPlaySeries3: {
		TID: IDPlaySeries3, Type: TypeDay, IconID: 20005, Series: IDPlaySeries2,
		Name: "对局20场", Desc: "每日进行20场游戏后领取奖励",
		Total: 20, Version: 10000,
		RewardList: []Reward{{ID: 1000, Num: 2000}},
	},
}


